Skip to content

Brickyard: a Luau / Roblox place-file compatible game platform sample - #6262

Open
shai-almog wants to merge 84 commits into
masterfrom
brickyard-platform
Open

shai-almog wants to merge 84 commits into
masterfrom
brickyard-platform

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Brickyard is a full-stack sample of a user-generated game platform. Players find experiences, play them with friends and earn progress. Creators build and publish experiences in an in-app studio that works on phone, tablet and desktop. Experiences are written in Luau, and the platform reads and writes Roblox place files (.rbxlx, plus .rbxl read-only). Everything was written clean room under an original name and art.

What's in it

  • maven/luau-runtime: a pure-Java Luau interpreter. Coroutines are interpreter frames, and every script runs under a step and string budget, so untrusted code cannot freeze or exhaust the device or the server.
  • maven/rbx-compat: the engine API, covering datatypes, the instance tree, services, rigid-body physics, humanoids, place I/O, and authoritative server replication with checks on what clients send. It also ships nine starter templates generated by tools/gen-templates.py; CI fails if the templates drift from the generator.
  • maven/rbx-view: the 3D play view on com.codename1.gpu.
  • scripts/brickyard: one Maven project with shared, common (the client) and backend (accounts, publishing and versions, DataStores, leaderboards, economy, season pass, quests, moderation, admin, and live play rooms).
  • Docs: the Brickyard-Implementors-Guide in the developer guide with 30 screenshots, and a /brickyard/ website page with six videos (desktop play and code, play with friends, game types, engagement, studio on phone and on tablet).
  • Framework changes the sample needed:
    • The simulator can preview native desktop menus. It adds sim_menu MCP tools, and recordings now include menus, typed text and letterboxing.
    • New PeerComponent.setLightweight.
    • ShareButton/InviteButton now refresh their icons when the UIID changes.
    • JSONParser now handles the \b and \f escapes.

Review

Two adversarial red-team rounds covered code, gameplay, design and cleanliness. Fixes include:

  • Bounds checks on place-file sizes and counts.
  • String, pattern, format, concat and buffer budgets.
  • InvokeClient results accepted only from the invoked player.
  • Validated MOVE frames, with a per-frame allowance.
  • Depth-limited wire decoding, and a room tick that survives any link.
  • Inbox, op and chat rate limits.
  • Serialized DataStore increments.
  • Goal hints in every game template.
  • Text that wraps instead of clipping.
  • A width-capped Home on tablet and desktop.

The recording-only bot tool and a stray harness were removed.

🤖 Generated with Claude Code

shai-almog and others added 30 commits November 13, 2026 17:12
A typed Java expression graph, printed to GLSL ES, MSL and HLSL by one
emitter, replaces inputs of the engine's own shader through hooks (vertex
offset, base colour, normal, metallic, roughness, emissive, discard), so a
custom surface keeps lighting, shadows, fog and tone mapping. Per-material
uniforms (16 vec4 slots) and textures (units 2-5) plus a clock are bound by
the GL, Metal, D3D11 and Linux GLES backends; ShaderEvaluator runs the same
graphs on the CPU for the software rasterizer and for gameplay code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ic sky IBL; soft shadows

Material maps compose into the material's ShaderMaterial (getEffectiveShader),
so every backend gets them through the existing hooks with no new vertex
layout: the tangent frame is derived from the surface normal
(ShaderNode.perturbNormal). glTF normal/occlusion/emissive/metallicRoughness
textures load onto AnimatedModel parts. PBR ambient now reflects the
hemisphere along the roughness-blurred reflection ray with Karis' fitted
split-sum BRDF on GLSL, Metal and HLSL. Light.setShadowSoftness widens the
3x3 PCF kernel on all six devices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tives.grid, Material.setFogged

Water, terrain, foliage, surfaces, toon, FX, liquids and sky built only
from public ShaderNode calls, plus six lighting presets. Every factory is
emitted through GLSL and evaluated on the CPU in ShaderLibraryTest, and
compiled with the Metal compiler locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hader clock; Splat on the library

PostProcess gains setGodRays, setChromaticAberration and setFxaa, written
once (GlslShaderGenerator.postEffects) and printed into the GLSL, Metal and
HLSL composites, with the parameters packed by GraphicsDevice.packPostEffects
on all seven devices and the iOS, Windows and Linux natives.

GraphicsDevice.drawInstanced and Model.setInstances draw copies of a mesh
that shaders tell apart with ShaderNode.instanceId, instanceRandom and
instanceColor. SpriteRenderer now advances the clock ShaderNode.time reads.

scripts/check-gpu-shaders.sh compiles every library shader and the
composite with glslang (GLSL ES 100, and HLSL through SPIR-V) and Metal;
PR CI runs it.

Splat: soft shadows, wind in its trees and bushes, puddles and grit on the
ground, thick glossy paint, FXAA, god rays and a touch of lens fringe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lery)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he 3D chapter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A material whose ShaderMaterial moves vertices or discards fragments now casts
the shadow of what is drawn: every backend builds a depth-only variant of the
material's own program (GLSL packed depth, Metal depth-only pipeline with a
discard-only fragment, HLSL R32 depth) for the shadow pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Light.setShadowCascades(2, farExtent) splits the shadow map into a near and a
far square of one atlas. The far cascade is the near view scaled in x and y,
so receivers need only the ratio (the fourth shadow parameter) and pick the
near square when the point falls inside it. Casters draw once per cascade
into their own viewport. gl3dBeginShadowPass takes the atlas width on iOS,
Mac, watch, Windows and Linux; inside a Metal shadow pass gl3dSetViewport
moves the shadow encoder's viewport instead of recording the frame's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnvironmentMaps bakes a sky or an equirect panorama into a six band
roughness atlas (plain 2D RGBA8, clamp, so GLES2/WebGL1 sample it);
Environment.setEnvironmentMap switches the lit generators to sample it
for ambient and the PBR specular. Bound on unit/slot 6 by the GL, Linux,
Metal and D3D devices. Fixes the polar-row blur radius overrunning its
weight table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GraphicsDevice.createRenderTarget/beginRenderTarget/endRenderTarget draw
into an ordinary Texture that later draws sample. GL devices flip clip
space Y and the winding inside a target so its texture comes out upright
like Metal's and Direct3D's. New natives gl3dCreateRenderTarget,
gl3dBeginRenderTarget and gl3dEndRenderTarget on iOS (Metal pass of its
own), Linux (shared FBO + depth) and Windows (RTV + DSV per target), with
Mac, watch and embedded stubs. GpuRenderTargetScreenshotTest shows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ambient occlusion, depth of field and outlines read the scene's depth in
the composite pass; a colour lookup strip (ColorLuts) maps the graded
colour. The shader text is shared by GLSL, Metal and HLSL. The GL
devices render the scene into a depth texture (falling back, with the
depth effects off, where ES 2 / WebGL 1 lack one), Metal stores and
samples its depth attachment, Direct3D views a typeless depth buffer.
Windows now uploads the whole post constant block; it copied 24 floats
and dropped the FXAA, aberration and god ray parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not nested

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…apture Splat shots

Splat and Skirmish measured operators from part buffers at a stride of
eight floats, which on a GPU-skinned device hold the sixteen-float bind
pose, so the framing collapsed and the characters fell out of view.
AnimatedModel.getBounds measures the posed model on either path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tubs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ples; snapshot queued JS host-call arrays; complete LUT textures on Android/JavaSE GL; seed goldens

- JS runtime marshalled fire-and-forget host-call arrays at flush time, so a
  reused array gave every queued call its last value (all skinned meshes
  posed by the last joint palette). Arrays are copied when queued.
- Android and JavaSE GL uploads left the default mipmapped min filter on a
  texture with no mipmaps: incomplete, sampled black (the post colour LUT).
- Shader gallery test waits for drawn frames instead of a fixed timer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ldens; keep Splat on released API

Harbour, RenderTarget, PostDepth and Skinning captured a blank view on the
Android emulator legs where the first frame's program compiles outlast the
fixed timer; they now poll until two frames have completed, as the gallery
does. Splat's e2e build compiles against the published release, which has
no shader API yet, so ArenaView goes back to master's materials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hello on windows-x64

The guide validator allows nothing but the include inside a source block.
The hello suite's ParparVM/JVM time ratio on windows-x64 rose with the six
new Gpu tests (CPU-side IBL and noise baking), not with a VM change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both blocks are parts of a renderer (a material, a GraphicsDevice set-up)
and cannot compile as a standalone Playground script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r Java 8

Master's pr.yml build-test (8) fails to compile AndroidCameraImpl at
startVideoRecording since #6231.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; Linux goldens; perf baseline

The Metal pipeline recovered the vertex stride from the first "|s" in its
key, which a custom shader ("|sh:") or skinned ("|skin3") material key now
contains ahead of the real "|sNN" segment. The stride parsed as zero, the
descriptor declared position alone and Metal rejected every pipeline that
reads a normal, uv or joints, so shader materials and skinned meshes were
missing on tvOS and iOS Metal. It now searches from the end for "|s" plus a
digit.

The GPU tests' frame gate could wait ~19.6s, past the 10s per-test budget
on HTML5, so a slow scene (GpuPostDepth) was killed before it captured; the
cap is 25 polls on HTML5 and 90 elsewhere.

Seeds the six new Gpu goldens for Linux x64 and arm64 and calibrates the
linux-x64 perf baseline for a runner CPU that had none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A depth-post frame on HTML5 outlasts the 200ms poll, so each poll queued
another render behind it; the backlog held the browser's main thread and
no timer fired until the test's 10s budget ran out (GpuPostDepth). The gate
now asks for a frame only once the previous request has started one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shai-almog and others added 22 commits November 16, 2026 05:12
…de, sim_menu MCP tools, menus in recordings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er) on phone and tablet, native OS menus on desktop, goal-and-win snippet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c PeerComponent.setLightweight; JavaSE peers snapshot their Swing buffer in lightweight mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…they show

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r colour, shared obby rules script

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er creator cards, rainbow obby in the gallery

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the last checkpoint, ReplicaServer.player; rbx-view: PlayView.setStick

Survival rounds (flood, meteors aimed near players, tornado) with Survivals
and Coins, and a roleplay town with doors, a job pad and pay. The obby
script set RespawnLocation to nil, which sent a fallen player back to the
lobby; CharacterAdded now pivots to the saved checkpoint, and rainbow.lua
holds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds fed by server leaderstats, agent play tools

- /api/playing: players per experience across live servers; Home shows
  "N playing".
- Friends rows show a name and an initial badge, not the account email.
- A room reads each player's numeric leaderstats every two seconds and
  sends the rise to Leaderboards.record, through the same per-minute bound
  an engine write passes. Nothing wrote scores before, so every board was
  empty.
- The stat list comes back as StatDto records: the generated client fetches
  a mapped list and could not map bare strings, so the picker never filled.
- Leaderboard screen in the dark theme, ranked rows.
- PlayMcp: brickyard_play_state/parts/input and brickyard_open for agents.
- Bots refresh their presence and race the rainbow course.
- Disaster Island and Brick Town in the template gallery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eachable from a desktop menu bar

Two characters on one spawn spot stood inside each other, and each one's
parts walled the other in from every side: frozen in a crowded lobby. A part
the character already overlaps no longer blocks it (CharacterWalkTest).
A desktop window hides the toolbar and lists the form's commands in its menu
bar; the back command and the unnamed settings gear never reached it, so a
desktop player could not leave a game or sign out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	CodenameOne/src/com/codename1/gpu/GraphicsDevice.java
#	CodenameOne/src/com/codename1/gpu/shaders/Foliage.java
#	CodenameOne/src/com/codename1/gpu/shaders/Liquid.java
#	CodenameOne/src/com/codename1/gpu/shaders/Noise.java
#	CodenameOne/src/com/codename1/gpu/shaders/Terrain.java
#	CodenameOne/src/com/codename1/impl/gpu/GlslShaderGenerator.java
#	Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java
#	Ports/JavaSE/src/com/codename1/impl/javase/record/SimulatorRecorder.java
#	maven/core-unittests/src/test/java/com/codename1/gpu/InstancingTest.java
#	maven/core-unittests/src/test/java/com/codename1/gpu/PostPassTest.java
#	scripts/check-copyright-headers.sh
#	scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/BaseTest.java
#	scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/GpuPostDepthScreenshotTest.java
#	scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/GpuPostPassScreenshotTest.java
#	scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/GpuRenderTargetScreenshotTest.java
#	scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/GpuShaderGalleryScreenshotTest.java
#	scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/GpuShaderHarbourScreenshotTest.java
#	scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/GpuSkinningScreenshotTest.java
…n and backend only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… screenshots

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, drop the Smoke harness

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st hostile input

Red-team findings, each with a test:
- .rbxl chunk sizes are checked before allocating; zstd output is capped.
- string.rep and pattern matching are charged to the script budget, with a
  hard cap on matcher steps; untrusted print never reaches System.out.
- InvokeClient results are accepted only from the invoked player, and a
  player who leaves resumes the calls waiting on them.
- MOVE refuses non-finite and non-rotation frames and spends one per-frame
  allowance for walking, rising and falling.
- Wire decoding is depth-limited; a room's tick survives any failing link,
  and a link that floods its inbox is dropped.
- DataStore increments are serialized per key, integer-only and
  overflow-checked; the backend logs through its logger.
- Simulator menu matching no longer folds case by locale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…atar fit their screens

A new player now sees each template's goal for a few seconds on joining.
Season and quest titles wrap instead of clipping, toasts replace each other,
the body chips fit, Home caps its width on tablets and desktops and stops
listing every game three times, and 'New' means few visits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing; caps on place counts, chat and invokes

Concatenation, string.format, table.concat and buffer.create all go through
Interp.chargeString. The binary place reader checks counts without
overflowing and holds a file to one decompressed budget. A player's ops per
message and per frame are capped, chat and InvokeServer are rate limited, and
chat lines are cut to 200 characters on a validated channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Taking master's side of the GPU files after #6232 landed lost turf(),
canopy() and the instance-colour fixes this branch had added on top, so
rbx-view no longer compiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts at the README for commands

The database and JVM server jobs could not resolve cn1-app-kit-backend.
The developer guide only takes source blocks included from docs/demos.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

@shai-almog

shai-almog commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 12 screenshots: 12 matched.
✅ JavaSE simulator integration screenshots matched stored baselines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

…BLOB

MySQL's default collation folds case and pads, and the ORM refuses a key
column that does either. V7 converts every table, as skirmish does, with
no-op twins for PostgreSQL and SQLite. The thumbnail column matches the
mapping's LONGBLOB. All 18 server test classes pass on MySQL 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ✅ ByteCodeTranslator: 0 findings (no issues)
    • ✅ android: 0 findings (no issues)
    • ✅ android-compat: 0 findings (no issues)
    • ✅ android-res-compiler: 0 findings (no issues)
    • ✅ backend: 0 findings (no issues)
    • ✅ backend-test: 0 findings (no issues)
    • ✅ build-engine: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-gradle-plugin: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ compose-compat: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ desktop-compat-runtime: 0 findings (no issues)
    • ✅ fxml-compiler: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
    • ✅ javac: 0 findings (no issues)
    • ✅ javafx-compat: 0 findings (no issues)
    • ✅ luau-runtime: 0 findings (no issues)
    • ✅ project-model: 0 findings (no issues)
    • ✅ python-runtime: 0 findings (no issues)
    • ✅ python-transpiler: 0 findings (no issues)
    • ✅ rbx-compat: 0 findings (no issues)
    • ✅ rbx-view: 0 findings (no issues)
    • ✅ swing-compat: 0 findings (no issues)
  • ✅ PMD: 0 findings (no issues) [Report archive]
  • ✅ Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

shai-almog and others added 2 commits November 17, 2026 09:40
GpuShaderGalleryScreenshotTest renders Liquid.lava(), and with this
branch's version (two 9-cell cellularEdge passes and seven fbm calls per
pixel) the software-rendered emulator stalled 2.5s on a frame and then
dropped off adb, failing both Android legs. Master's lava passes there,
and Brickyard's lava parts use it as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The branch's two-sided SSAO changed the GpuPostDepth golden on Android.
Brickyard does not depend on it, so the framework keeps master's pass
rather than reseeding goldens on every port from a sample's PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant